import java.io.Console;

public class PasswordTest {

  public static void main(String[] args) {
    Console cons = System.console();
    char[] passwd = cons.readPassword("%s ", "Password:");
    System.out.println("Your password is " + new String(passwd));
  }

}
